package com.lemon.cloud.admin.web;

import com.lemon.cloud.admin.service.AppService;
import com.lemon.cloud.comm.model.ResultMsg;
import io.lettuce.core.KeyValue;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/app")
@Tag(name = "app接口")
public class AppController {

    @Autowired
    private AppService appService;

    @PostMapping("/code")
    @Operation(summary = "获取sms验证码")
    @Parameters({
            @Parameter(name = "key", description = "手机号码", required = true, in = ParameterIn.QUERY)
    })
    public ResultMsg<Boolean> getCode(@RequestBody KeyValue<String, String> keyValue) {
        String key = keyValue.getKey();
        return appService.getSmsCode(key);
    }

}
